import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayTransactionVO, PayTransactionForm, PayTransactionQuery } from '@/api/shopping/wx/payTransaction/types';

/**
 * 查询微信支付的动账流水记录列表
 * @param query
 * @returns {*}
 */

export const listPayTransaction = (query?: PayTransactionQuery): AxiosPromise<PayTransactionVO[]> => {
  return request({
    url: '/shopping/payTransaction/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询微信支付的动账流水记录详细
 * @param id
 */
export const getPayTransaction = (id: string | number): AxiosPromise<PayTransactionVO> => {
  return request({
    url: '/shopping/payTransaction/' + id,
    method: 'get'
  });
};

/**
 * 新增微信支付的动账流水记录
 * @param data
 */
export const addPayTransaction = (data: PayTransactionForm) => {
  return request({
    url: '/shopping/payTransaction',
    method: 'post',
    data: data
  });
};

/**
 * 修改微信支付的动账流水记录
 * @param data
 */
export const updatePayTransaction = (data: PayTransactionForm) => {
  return request({
    url: '/shopping/payTransaction',
    method: 'put',
    data: data
  });
};

/**
 * 删除微信支付的动账流水记录
 * @param id
 */
export const delPayTransaction = (id: string | number | Array<string | number>) => {
  return request({
    url: '/shopping/payTransaction/' + id,
    method: 'delete'
  });
};
